﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using AForge.Video;
using AForge.Video.DirectShow;
using ZXing;
using ZXing.SkiaSharp;



namespace ELiXi.Views
{
    public partial class InStock_cameraForm : UserControl
    {
        #region 视频类
        // 视频设备集合
        private FilterInfoCollection videoDevices;
        // 当前使用的视频捕获设备
        private VideoCaptureDevice videoSource;
        // 条形码读取器实例
        private readonly BarcodeReader barcodeReader;
        // 标记是否已扫描到条形码
        private bool isBarcodeScanned = false;
        // 标记停止操作是否正在进行
        private bool isStopping = false;
        // 用于居中显示图像的Bitmap
        private Bitmap centeredBitmap;
        // 用于窗体关闭的取消令牌
        private CancellationTokenSource formClosingCts;

        // 性能优化变量
        private DateTime lastDecodeTime = DateTime.MinValue;
        private const int MIN_DECODE_INTERVAL = 500; // 最小识别间隔(毫秒)
        private bool isProcessingFrame = false;
        private Bitmap lastProcessedFrame;
        private DateTime lastFrameTime = DateTime.MinValue;
        private const int MAX_FPS = 15; // 最大帧率限制

        //用于记录信息核验
        private bool isCheck = false;
        #endregion
        public InStock_cameraForm()
        {
            InitializeComponent();
        }

       
        
    }
}
